From: Florian Eckert Date: Mon, 6 Oct 2025 11:05:10 +0000 (+0200) Subject: luci-mod-network: make state of interface more clear X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=ed2c7f896568f97016ed0543c568266847efe67e;p=project%2Fluci.git luci-mod-network: make state of interface more clear In the current source, it is difficult to see when the disable button should be shown or not. This commit adjusts this and moves the handling to an if else statement, so that it can be easily seen. Signed-off-by: Florian Eckert --- diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 696d324da6..f7e092e49a 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -489,13 +489,11 @@ return view.extend({ 'class': 'cbi-button cbi-button-neutral reconnect', 'click': iface_updown.bind(this, true, section_id), 'title': _('Reconnect this interface'), - 'disabled': dynamic ? 'disabled' : null }, _('Restart')), E('button', { 'class': 'cbi-button cbi-button-neutral down', 'click': iface_updown.bind(this, false, section_id), 'title': _('Shutdown this interface'), - 'disabled': (dynamic || disabled) ? 'disabled' : null }, _('Stop')), tdEl.lastChild.firstChild, tdEl.lastChild.lastChild @@ -503,13 +501,27 @@ return view.extend({ if (!dynamic && net && !uci.get('network', net.getName())) { tdEl.lastChild.childNodes[0].disabled = true; + tdEl.lastChild.childNodes[1].disabled = true; tdEl.lastChild.childNodes[2].disabled = true; tdEl.lastChild.childNodes[3].disabled = true; } - - if (dynamic) { - //disable the 'Edit' button on dynamic interfaces + else if(dynamic === true) { + tdEl.lastChild.childNodes[0].disabled = true; + tdEl.lastChild.childNodes[1].disabled = true; tdEl.lastChild.childNodes[2].disabled = true; + tdEl.lastChild.childNodes[3].disabled = true; + } + else if (disabled === true){ + tdEl.lastChild.childNodes[0].disabled = false; + tdEl.lastChild.childNodes[1].disabled = true; + tdEl.lastChild.childNodes[2].disabled = false; + tdEl.lastChild.childNodes[3].disabled = false; + } + else { + tdEl.lastChild.childNodes[0].disabled = false; + tdEl.lastChild.childNodes[1].disabled = false; + tdEl.lastChild.childNodes[2].disabled = false; + tdEl.lastChild.childNodes[3].disabled = false; } return tdEl;